# !/usr/bin/env python3
# -*- coding: utf-8 -*-

# @Time : 2022/6/25 17:52

# @Author : xyjiang1216
# @Email : jiangxuyan@nudt.edu.cn
# @File : gcl_tbl_structure.py
# @Version: planner_builder 1.0


import ctypes
from typing import List
from tsn_builder_struct.table_length import GCL_TBL_LEN

c_uint32 = ctypes.c_uint32


class GCLEachPort:
    def __init__(self,
                 port_id,
                 gate_state_list: List[int]):
        self.port_id = port_id
        if len(gate_state_list) <= GCL_TBL_LEN:
            self.gate_each_port = gate_state_list


class GCLEachNode:
    def __init__(self,
                 node_id: int,
                 gcl: List[GCLEachPort]):
        self.node_id = node_id
        self.gcl = gcl


class GCLTbl:
    def __init__(self):
        # 网络内所有节点的GCL
        self.tbl_set = []

    def append_gcl_each_node(self,
                             gcl_each_node: GCLEachNode):
        self.tbl_set.append(gcl_each_node)